import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import fs from 'fs'
import vueDevTools from 'vite-plugin-vue-devtools'

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
    },
  },
  server: {
    host: '0.0.0.0',
    port: 5173,
    https: {
      key: fs.readFileSync('./key.pem'),
      cert: fs.readFileSync('./cert.pem')
    },
    proxy: {
      '/api': {
        //target: 'https://e61cf922-861f-7823-2c1e-a30a9e898996.ofalias.com:33000',
        target: 'https://47.108.91.29:33000',
        //target: 'http://e61cf922-861f-7823-2c1e-a30a9e898996.ofalias.com:62860',
        //target: 'http://localhost:8081',
        changeOrigin: true,
        secure: false,  
        ws: true       
      },
    },
    cors: true
},
});